package cn.ziroom.contract.service;

import java.util.List;

import com.koonet.webservice.service.Esmsservice;
import com.koonet.webservice.service.EsmsservicePortType;

import cn.common.util.BeanUtils;
import cn.common.util.CreateRadomNum;
import cn.ziroom.contract.dao.HouseAndRoomDao;
import cn.ziroom.contract.data.ContractData;
import cn.ziroom.contract.data.CustomerData;
import cn.ziroom.contract.data.HouseData;
import cn.ziroom.contract.data.RegionData;
import cn.ziroom.contract.data.RoomData;
import cn.ziroom.contract.domain.Contract;
import cn.ziroom.contract.domain.Customer;
import cn.ziroom.contract.domain.House;
import cn.ziroom.contract.domain.Referee;
import cn.ziroom.contract.domain.Room;
import cn.ziroom.contract.mapper.ContractMapper;
import cn.ziroom.contract.mapper.CustomerMapper;
import cn.ziroom.contract.mapper.HouseMapper;
import cn.ziroom.contract.mapper.RefereeMapper;
import cn.ziroom.contract.mapper.RoomMapper;

/**
 * 收/出房合同业务处理类
 * 
 * @author Administrator
 * 
 */
public class ContractService {

	private ContractMapper contractMapper; // 合同对象

	private CustomerMapper customerMapper; // 客户对象

	private HouseMapper houseMapper; // 房屋对象

	private RoomMapper roomMapper; // 房间对象

	private HouseAndRoomDao houseAndRoomDao; // 房屋和房间关联关系对象
	
	private RefereeMapper refereeMapper;

	// private UserMapper userMapper;

	/**
	 * 收房合同业务流程数据同步处理方法 返回字符串采用下划线来分隔， 例如 ： success_BJCY10802266成功的传输到系统
	 * 
	 * @param recive
	 */
	public String synchroReciveContract(ContractData recive) {
		/*
		 * String stewart = recive.getHouseData().getStewardCode(); String c =
		 * userMapper.selectByCode(stewart); if(c == null) {
		 * System.out.println("[Error:]管家编号不存在"); System.out.println(
		 * "======================================================================="
		 * ); System.out.println(); return "[Error:] 管家编号不存在"; }
		 * 
		 * try{ ContractValidate.validate(recive); }catch(Exception e){
		 * System.out.println("[Error:]" + e.getMessage()); System.out.println(
		 * "======================================================================="
		 * ); System.out.println(); return "[Error:]" + e.getMessage(); }
		 */

		// step 1 获得收房合同的用户信息，根据客户编号查询客户是否存在
		CustomerData custData = recive.getCustomerData();

		String code = customerMapper.selectCodeById(custData.getSysCustId());
		Customer customer = new Customer();
		BeanUtils.copyProperties(custData, customer);
		if (code == null) {
			customer.setCustType("YZ");
			// 保存客户资料信息
			customerMapper.insert(customer);
		} else {
			customerMapper.update(customer);
		}

		// step 2 保存合同信息，对于合同信息同步不做业务上验证。
		Contract contract = new Contract();

		BeanUtils.copyProperties(recive, contract);
		// 合同信息处理
		Contract a = contractMapper.selectByCode(contract);
		if (a != null) {
			contractMapper.update(contract);
		} else {
			contractMapper.insert(contract);
		}

		// 形成房间标题的方法
		// String houseTitle =
		// houseAndRoomDao.createHouseTitle(recive.getHouseData());

		// 保存房间信息
		List<RoomData> roomList = recive.getRoomList();
		for (RoomData rd : roomList) {

			Room r = new Room();

			BeanUtils.copyProperties(rd, r);
			// 房间扩展信息处理
			List<RegionData> regionDataList = rd.getRegionDataList();
			if (regionDataList != null) {
				for (RegionData region : regionDataList) {
					// 信息对应的相应的房间字典上
					if (region.getRegionType().equalsIgnoreCase("saloon")) {
						r.setSaloonLength(region.getRegionLength());
						r.setSaloonWidth(region.getRegionWidth());
						r.setSaloonHeight(region.getRegionHeight());
						r.setSaloonMaster(region.getSaloonMaster());
						r.setSaloonMaterial(region.getSaloonMaterial());
						r.setSaloonPosition(region.getSaloonPosition());
						r.setSaloonDesc(region.getRegionComment());
					} else if (region.getRegionType().equalsIgnoreCase("kitchen")) {
						r.setKitchenLength(region.getRegionLength());
						r.setKitchenWidth(region.getRegionWidth());
						r.setKitchenHeight(region.getRegionHeight());
						r.setKitchenGastype(region.getKitchenGastype());
						r.setKitchenStove(region.getKitchenStove());
						r.setKitchenDesc(region.getRegionComment());
					} else if (region.getRegionType().equalsIgnoreCase("toliet")) {
						r.setTolietExist("Y");
						r.setToiletLength(region.getRegionLength());
						r.setToiletWidth(region.getRegionWidth());
						r.setToiletHeight(region.getRegionHeight());
						r.setToiletCurtain(region.getToiletCurtain());
						r.setToiletFan(region.getToiletFan());
						r.setToiletWindow(region.getToiletWindow());
						r.setToiletDesc(region.getRegionComment());
					} else if (region.getRegionType().equalsIgnoreCase("balcony")) {
						r.setBalconyExist("Y");
						r.setBalconyLength(region.getRegionLength());
						r.setBalconyWidth(region.getRegionWidth());
						r.setBalconyHeight(region.getRegionHeight());
						r.setBalconyType(region.getBalconyType());
						r.setBalconyDesc(region.getRegionComment());
					} else if (region.getRegionType().equalsIgnoreCase("garder")) {
						r.setGarderExist("Y");
						r.setGardenLength(region.getRegionLength());
						r.setGardenWidth(region.getRegionWidth());
						r.setGardenHeight(region.getRegionHeight());
						r.setGardenType(region.getBalconyType());
						r.setGardenClay(region.getGardenClay());
						r.setGardenDesc(region.getRegionComment());
					} else if (region.getRegionType().equalsIgnoreCase("terrace")) {
						r.setTerraceExist("Y");
						r.setTerraceLength(region.getRegionLength());
						r.setTerraceWidth(region.getRegionWidth());
						r.setTerraceHeight(region.getRegionHeight());
						r.setTerraceDesc(region.getRegionComment());
					}
				}
			}
			Room rm = new Room();
			rm.setSysRoomId(rd.getSysRoomId());
			rm.setSysHouseId(rd.getSysHouseId());
			Room rc = roomMapper.selectByCode(rm);
			if (!r.getRoomType().equals("KITCHEN")) {
				// r.setRoomName(houseAndRoomDao.createRoomTitle(houseTitle,
				// r.getRoomPosition()));
			}
			if (rc != null) {// 如果先前有房间信息， 则需要去修改存在房间的信息。
				// TODO 先处理：先删除房间区域（以后修正）
				roomMapper.saloon(rc);
				roomMapper.kitchen(rc);
				roomMapper.toilet(rc);
				roomMapper.balcony(rc);
				roomMapper.garder(rc);
				roomMapper.terrace(rc);
				// 更新房间信息
				roomMapper.update(r);
			} else {// 新增房间，需要设置后台端口管理设置信息
				r.setIsAvailable("N");
				r.setIsPromotions("N");
				r.setIsShow("N");
				r.setIsTop("N");
				r.setRadomNum(CreateRadomNum.createNum());
				roomMapper.insert(r);
			}
		}
		// 保存合同中的房屋，房间信息
		HouseData houseData = recive.getHouseData();

		// 检查该房屋是否存在
		House h = houseMapper.selectByCode(houseData.getSysHouseId());
		House house = new House();
		BeanUtils.copyProperties(houseData, house);
		house.setRentNum(houseAndRoomDao.countFreeNumber(house.getSysHouseId()));
		// house.setTitle(houseTitle);
		if (h != null) {
			houseMapper.update(house);
		} else {
			house.setIsTop("N");
			house.setIsShow("N");
			house.setIsAvailable("N");
			house.setIsPromotions("N");
			houseMapper.insert(house);
		}

		return "success";
	}

	/**
	 * 出房合同业务处理方法
	 * 
	 * @param outContractData
	 */
	public String synchroOutContract(ContractData outContractData) {

		// 数据验证
		/*
		if (outContractData.getSysCustId() == null) {
			return "error_出房合同中(sysCustId)没有唯一标识";
		}
		if (outContractData.getSysContractId() == null) {
			return "error_出房合同中(sysContractId)没有唯一标识";
		}
		if (outContractData.getSysHouseId() == null) {
			return "error_出房合同中(sysHouseId)没有唯一标识";
		}
		if (!StringUtils.isEmpty(outContractData.getCustCode())) {
			return "error_出房合同客户编号(custCode)不存在";
		}
		if (!StringUtils.isEmpty(outContractData.getHouseCode())) {
			return "error_出房合同房源编号(houseCode)不存在";
		}
		if (!StringUtils.isEmpty(outContractData.getContractCode())) {
			return "error_出房合同号(contractCode)不存在";
		}
		if (outContractData.getCustomerData().getSysCustId() == null) {
			return "error_出房合同关联的客户信息中客户没有唯一（SysCustId）标识";
		}
		if (outContractData.getRoomList() != null) {
			for (RoomData rd : outContractData.getRoomList()) {
				if (rd.getSysRoomId() == null) {
					return "error_出房合同关联的房间没有房间唯一(SysRoomId)标识";
				}
				if (!StringUtils.isEmpty(rd.getRoomCode())) {
					return "error_出房合同关联的房间中房间编号不存(roomCode)在";
				}
				if (!StringUtils.isEmpty(rd.getRentStatus())) {
					return "error_出房合同关联的房间中房源出租状态(rentStatus)不存在";
				}
			}
		}
		if (outContractData.getHouseData().getSysHouseId() == null) {
			return "error_出房合同关联的房屋中唯一(SysHouseId)标识不存在";
		}
		*/
		// 保存客户资料信息
		CustomerData custData = outContractData.getCustomerData();
		String code = customerMapper.selectCodeById(custData.getSysCustId());
		Customer customer = new Customer();
		BeanUtils.copyProperties(custData, customer);
		if (code == null) {
			customer.setCustType("KH");
			customerMapper.insert(customer);
		} else {
			customerMapper.update(customer);
		}

		// 房间信息更改
		if (outContractData.getRoomList() != null) {
			for (RoomData rd : outContractData.getRoomList()) {
				Room r = new Room();
				r.setCustSex(custData.getSex());
				r.setCustCode(custData.getCustCode());
				r.setSysHouseId(rd.getSysHouseId());
				r.setSysRoomId(rd.getSysRoomId());
				r.setRoomStatus(rd.getRoomStatus());
				r.setRentStatus(rd.getRentStatus());
				roomMapper.update(r);
			}
		}

		// 房屋信息更改
		House h = new House();
		h.setRentNum(houseAndRoomDao.countFreeNumber(outContractData.getHouseData().getSysHouseId()));
		h.setHouseStatus(outContractData.getHouseData().getHouseStatus());
		h.setRentStatus(outContractData.getHouseData().getRentStatus());
		h.setSysHouseId(outContractData.getHouseData().getSysHouseId());
		houseMapper.update(h);

		// 保存合同信息
		Contract c = new Contract();
		BeanUtils.copyProperties(outContractData, c);
		Contract ct = contractMapper.selectByCode(c);

		if (ct != null) {
			contractMapper.update(c);
		} else {
			contractMapper.insert(c);
		}

		// 是否含有推荐人
		if(outContractData.getSysRecommendCustId() != null && outContractData.getSysRecommendCustId() != 0) {
			// 根据收出房合同ID查询是否包含推荐人如果存在删除。
			Referee referee = new Referee();
			referee.setSysContractId(outContractData.getSysContractId());
			referee = refereeMapper.selectById(referee);
			boolean isExist = false;
			if(referee != null && referee.getId() != null) {
				isExist = true;
				refereeMapper.deleteById(referee.getId());
			}
			
			// 保存推荐人信息
			referee = new Referee();
			referee.setSysContractId(outContractData.getSysContractId());
			referee.setSysCustId(outContractData.getSysRecommendCustId());
			referee.setSysRetId(outContractData.getCustomerData().getSysCustId());
			referee.setContractType(outContractData.getContractType());
			referee.setRecom("N");
			String name = "";
			String tel = "";
			if(outContractData.getCustName() != null && !outContractData.getCustName().equals("")) {				
				referee.setCustName(outContractData.getCustName());
				referee.setTelphone(outContractData.getTelphone());
				name = outContractData.getCustName();
				tel = outContractData.getTelphone();
				referee.setCertNo(outContractData.getCertNo());
			} else {
				Customer r_customer = customerMapper.selectBySysCustId(outContractData.getSysRecommendCustId());
				referee.setCustName(r_customer.getCustName());
				referee.setTelphone(r_customer.getPhone());
				name = r_customer.getCustName();
				tel = r_customer.getPhone();
				referee.setCertNo(r_customer.getCertNum());
			}
			refereeMapper.insert(referee);
			// 统计推荐人数量
			
			if(!isExist) {
				int count = refereeMapper.countBySyscustId(outContractData.getSysRecommendCustId());
				Esmsservice ess = new Esmsservice();
				EsmsservicePortType t = ess.getEsmsserviceHttpPort();
				String info = "";
				if(count == 1) {					
					info = "恭喜" + name + "推荐第一位好友入住自如友家，请登录http://www.ziroom.com网领取奖品。";
				} else if(count >= 2) {
					info = "恭喜" + name + "推荐第二位好友入住自如友家，请登录http://www.ziroom.com网领取奖品。";
				}
				if(!info.equals("")) {
					tel = "13521898794";
					String msg = t.sendLongSmsAsNormal(tel, info, null, "", "ziruputong", "123456");
					if(msg.equals("0")) {	
						System.out.println("发送成功！" + info);
					} else {
						System.out.println("信息发送失败:" + msg);
					}
				}
			}
		}
		
		return "success";
	}

	/**
	 * 合同解约处理
	 * 
	 * @param channelContract
	 */
	public String synchroChannelContract(ContractData channelContract) {
		/*
		if (channelContract.getSysContractId() == null) {
			return "error_合同唯一标识(sysContractId)不存在";
		}
		if (!StringUtils.isEmpty(channelContract.getContractCode())) {
			return "error_合同编号(contractCode)不存在";
		}
		if (!StringUtils.isEmpty(channelContract.getContractState())) {
			return "error_合同状态(contractState)不存在";
		}
		if (channelContract.getHouseData() != null) {
			if (channelContract.getHouseData().getSysHouseId() == null) {
				return "error_合同编号关联房屋属性中房源唯一标识(SysHouseId)不存在";
			}
			if (!StringUtils.isEmpty(channelContract.getHouseData().getHouseCode())) {
				return "error_合同编号关联房屋属性房源编号(houseCode)不存在";
			}
		}
		if (channelContract.getRoomList() != null) {
			for (RoomData rd : channelContract.getRoomList()) {
				if (rd.getSysRoomId() == null) {
					return "error_合同编号关联房间属性中房间唯一标识(SysRoomId)不存在";
				}
				if (!StringUtils.isEmpty(rd.getRoomCode())) {
					return "error_合同编号关联房间属性房间编号(roomCode)不存在";
				}
			}
		}
		*/
		// 合同处理
		Contract c = new Contract();
		BeanUtils.copyProperties(channelContract, c);
		contractMapper.update(c);
		Integer sysHouseId = null;
		// 房间处理
		if (channelContract.getRoomList() != null) {
			for (RoomData rd : channelContract.getRoomList()) {
				Room r = new Room();
				sysHouseId = rd.getSysHouseId();
				r.setCustCode("");
				r.setCustSex("");
				r.setSysHouseId(rd.getSysHouseId());
				r.setSysRoomId(rd.getSysRoomId());
				r.setRoomStatus(rd.getRoomStatus());
				r.setRentStatus(rd.getRentStatus());
				roomMapper.update(r);
			}
		}

		// 房屋处理
		if (channelContract.getHouseData() != null) {
			House h = new House();
			h.setRentNum(houseAndRoomDao.countFreeNumber(channelContract.getHouseData().getSysHouseId()));
			h.setHouseStatus(channelContract.getHouseData().getHouseStatus());
			h.setRentStatus(channelContract.getHouseData().getRentStatus());
			h.setSysHouseId(channelContract.getHouseData().getSysHouseId());
			houseMapper.update(h);
		} else {
			if (sysHouseId != null) {
				House h = new House();
				h.setRentNum(houseAndRoomDao.countFreeNumber(sysHouseId));
				h.setSysHouseId(sysHouseId);
				houseMapper.update(h);
			}
		}

		return "success";
	}

	/**
	 * 合同信息更改数据同步方法
	 * 
	 * @param contractData
	 */
	public String synchroModifyContract(ContractData contractData) {

		// 验证合同的数据有效性
		/*
		if (contractData.getSysContractId() == null) {
			return "error_合同唯一标识（sysConstractId）不存在";
		}
		if (contractData.getSysCustId() == null) {
			return "error_合同客户唯一(sysCustId)标识不存在";
		}
		if (contractData.getSysHouseId() == null) {
			return "error_合同房源唯一(sysHouseId)标识不存在";
		}
		if (!StringUtils.isEmpty(contractData.getContractCode())) {
			return "error_合同编号(contractCode)不存在";
		}
		if (!StringUtils.isEmpty(contractData.getHouseCode())) {
			return "error_房源编号(houseCode)不存在";
		}
		if (!StringUtils.isEmpty(contractData.getCustCode())) {
			return "error_客户编号(custCode)不存在";
		}
		if (!StringUtils.isEmpty(contractData.getContractState())) {
			return "error_合同状态(ContractState)不存在";
		}
		*/
		Contract c = new Contract();
		BeanUtils.copyProperties(contractData, c);
		contractMapper.update(c);

		// 是否含有推荐人
		if(contractData.getSysRecommendCustId() != null && contractData.getSysRecommendCustId() != 0) {
			// 根据收出房合同ID查询是否包含推荐人如果存在删除。
			Referee referee = new Referee();
			referee.setSysContractId(contractData.getSysContractId());
			referee = refereeMapper.selectById(referee);
			String recom = null;
			boolean isExist = false;
			if(referee != null && referee.getId() != null) {
				recom = referee.getRecom();
				refereeMapper.deleteById(referee.getId());
				isExist = true;
			}
			
			// 保存推荐人信息
			referee = new Referee();
			referee.setSysContractId(contractData.getSysContractId());
			referee.setSysCustId(contractData.getSysRecommendCustId());
			//referee.setSysRetId(contractData.getCustomerData().getSysCustId());
			referee.setContractType(contractData.getContractType());
			if(recom != null && !recom.equals("")) {				
				referee.setRecom(recom);
			} else {
				referee.setRecom("N");
			}
			String name = "";
			String tel = "";
			if(contractData.getCustName() != null && !contractData.getCustName().equals("")) {				
				referee.setCustName(contractData.getCustName());
				referee.setTelphone(contractData.getTelphone());
				referee.setCertNo(contractData.getCertNo());
				name = contractData.getCustName();
				tel = contractData.getTelphone();
			} else {
				Customer r_customer = customerMapper.selectBySysCustId(contractData.getSysRecommendCustId());
				referee.setCustName(r_customer.getCustName());
				referee.setTelphone(r_customer.getPhone());
				referee.setCertNo(r_customer.getCertNum());
				name = r_customer.getCustName();
				tel = r_customer.getPhone();
			}
			refereeMapper.insert(referee);
			if(!isExist) {
				int count = refereeMapper.countBySyscustId(contractData.getSysRecommendCustId());
				Esmsservice ess = new Esmsservice();
				EsmsservicePortType t = ess.getEsmsserviceHttpPort();
				String info = "";
				if(count == 1) {					
					info = "恭喜" + name + "推荐第一位好友入住自如友家，请登录http://www.ziroom.com网领取奖品。";
				} else if(count >= 2) {
					info = "恭喜" + name + "推荐第二位好友入住自如友家，请登录http://www.ziroom.com网领取奖品。";
				}
				if(!info.equals("")) {
					tel = "13521898794";
					String msg = t.sendLongSmsAsNormal(tel, info, null, "", "ziruputong", "123456");
					if(msg.equals("0")) {	
						System.out.println("发送成功！" + info);
					} else {
						System.out.println("信息发送失败:" + msg);
					}
				}
			}
		}
		return "success";
	}

	/**
	 * 合同作废业务处理方法
	 * 
	 * @param contractCode
	 */
	public String synchroInvalidContract(ContractData contractData) {
		/*
		if (contractData.getSysContractId() == null) {
			return "error_合同编号中唯一标识(SysContractId)不存在";
		}
		if (!StringUtils.isEmpty(contractData.getContractCode())) {
			return "error_合同编号(contractCode)不存在";
		}
		if (!StringUtils.isEmpty(contractData.getContractState())) {
			return "error_合同状态(contractState)不存在";
		}
		// 房屋处理
		if (contractData.getHouseData() != null) {
			if (contractData.getHouseData().getSysHouseId() == null) {
				return "error_合同关联房屋的房源唯一标识(SysHouseId)不存在";
			}
			if (!StringUtils.isEmpty(contractData.getHouseData().getHouseCode())) {
				return "error_合同关联房屋的房源编号(houseCode)不存在";
			}
		}
		// 房间处理
		if (contractData.getRoomList() != null) {
			for (RoomData rd : contractData.getRoomList()) {
				if (rd.getSysRoomId() == null) {
					return "error_合同关联房间的房间唯一标识(SysRoomId)不存在";
				}
				if (!StringUtils.isEmpty(rd.getRoomCode())) {
					return "error_合同关联房间的房间编号(RoomCode)不存在";
				}
			}
		}
		*/
		// 合同处理
		Contract c = new Contract();
		BeanUtils.copyProperties(contractData, c);
		contractMapper.update(c);
		Integer sysHouseId = null;
		// 房间处理
		if (contractData.getRoomList() != null) {
			for (RoomData rd : contractData.getRoomList()) {
				Room r = new Room();
				sysHouseId = rd.getSysHouseId();
				r.setCustCode("");
				r.setCustSex("");
				r.setSysHouseId(rd.getSysHouseId());
				r.setSysRoomId(rd.getSysRoomId());
				r.setRoomStatus(rd.getRoomStatus());
				r.setRentStatus(rd.getRentStatus());
				r.setFlag(rd.getFlag());
				roomMapper.update(r);
			}
		}

		// 房屋处理
		if (contractData.getHouseData() != null) {
			House h = new House();
			h.setRentNum(houseAndRoomDao.countFreeNumber(contractData.getHouseData().getSysHouseId()));
			h.setHouseStatus(contractData.getHouseData().getHouseStatus());
			h.setRentStatus(contractData.getHouseData().getRentStatus());
			h.setSysHouseId(contractData.getHouseData().getSysHouseId());
			h.setFlag(contractData.getHouseData().getFlag());
			houseMapper.update(h);
		} else {
			if (sysHouseId != null) {
				House h = new House();
				h.setRentNum(houseAndRoomDao.countFreeNumber(sysHouseId));
				h.setSysHouseId(sysHouseId);
				houseMapper.update(h);
			}
		}

		return "success";
	}

	/**
	 * 新增客户资料信息同步业务处理方法
	 * 
	 * @param customerData
	 */
	public void synchroAddCustomer(CustomerData customerData) {
		synchroCustomer(customerData);
	}

	/**
	 * 修改客户资料信息同步业务处理方法
	 * 
	 * @param customerData
	 */
	public void synchroUpdateCustomer(CustomerData customerData) {
		synchroCustomer(customerData);
	}

	/**
	 * 删除客户资料信息同步业务处理方法
	 * 
	 * @param customerData
	 */
	public void synchroDelCustomer(CustomerData customerData) {
		customerMapper.deleteById(customerData.getSysCustId());
	}

	/**
	 * 客户资料信息
	 * 
	 * @param customerData
	 */
	public String synchroCustomer(CustomerData customerData) {

		// 数据验证
		/*
		if (customerData.getSysCustId() == null) {
			return "error_客户唯一标识(sysCustId)不存在";
		}
		if (!StringUtils.isEmpty(customerData.getCustCode())) {
			return "error_客户编号(CustCode)不存在";
		}
		*/
		String code = customerMapper.selectCodeById(customerData.getSysCustId());
		Customer c = new Customer();
		BeanUtils.copyProperties(customerData, c);
		if (code != null) {
			customerMapper.update(c);
		} else {
			customerMapper.insert(c);
		}

		return "success";
	}

	public void setContractMapper(ContractMapper contractMapper) {
		this.contractMapper = contractMapper;
	}

	public void setCustomerMapper(CustomerMapper customerMapper) {
		this.customerMapper = customerMapper;
	}

	public void setHouseMapper(HouseMapper houseMapper) {
		this.houseMapper = houseMapper;
	}

	public void setRoomMapper(RoomMapper roomMapper) {
		this.roomMapper = roomMapper;
	}

	public void setHouseAndRoomDao(HouseAndRoomDao houseAndRoomDao) {
		this.houseAndRoomDao = houseAndRoomDao;
	}

	public void setRefereeMapper(RefereeMapper refereeMapper) {
		this.refereeMapper = refereeMapper;
	}

}